﻿
Ext.onReady(function () {

    if (treePanel) {


        treePanel.onSelectNode = function (tree, node) {
            //Need double remove. Why? I don't know :(
            $("#paymentDetailMenuItem").removeClass('invisible');
            $("#paymentDetailMenuItem").removeClass('invisible');
            $("#paymentStatementMenuItem").removeClass('invisible');
            $("#paymentStatementMenuItem").removeClass('invisible');
            
            //Push parameters into the form
           
            var paymentId = node.id;
            $("#paymentId").attr("value", paymentId);
        };
        treePanel.onDeselectNode = function (tree, node) {
            $("#paymentDetailMenuItem").addClass('invisible');
            $("#paymentId").attr("value", '');
        };

        var mainPanel = new Ext.Panel({
            title: 'Payments List',
            renderTo: 'tree', //Ext.getBody(),
            layout: 'border',
            width: 500,
            height: 500,
            items: [
                    treePanel
                ]
        });
    }
});